/*
 * ArrowButton.cpp
 *
 *  Created on: 10-12-2010
 *      Author: Piotr
 */

#include "gui/ArrowButton.hpp"
#include "pch.hpp"

ArrowButton::ArrowButton() :
	angleInDegrees(0)
{

}

ArrowButton::~ArrowButton()
{

}

ArrowButton::ArrowButton(int angleInDegrees) :
	angleInDegrees(angleInDegrees)
{

}

void ArrowButton::setAngle(int angleInDegrees)
{
	this->angleInDegrees = angleInDegrees;
}

void ArrowButton::draw(const ClipArea& clipArea)
{
	const float width = getSize().getWidth();
	const float height = getSize().getHeight();

	const float halfWidth = width / 2;
	const float halfHeight = height / 2;

	glTranslatef(halfWidth, halfHeight, 0.0f);
	glRotatef(angleInDegrees, 0.0f, 0.0f, 1.0f);
	glTranslatef(-halfWidth, -halfHeight, 0.0f);
	Button::draw(clipArea);

	glRectf(width / 3, height / 3, 2 * width / 3, 2 * height / 3);
	glRectf(5 * width / 12, height / 6, 7 * width / 12, 2 * height / 3);

	glTranslatef(halfWidth, halfHeight, 0.0f);
	glRotatef(-angleInDegrees, 0.0f, 0.0f, 1.0f);
	glTranslatef(-halfWidth, -halfHeight, 0.0f);
}
